alert("为了您能够更方便快捷地管理您的网站, 强烈建议使用以下浏览器:\n" + 
						  "Google Chrome 10+ \n" + 
						  "Apple Safari 5+ \n" + 
						  "Mozilla Firefox 4+ \n" + 
						  "Internet Explorer 8+ \n" + 
						  "请尽量避免使用代版本IE浏览器" + 
						  "如出现错误, 我们会先认为您选用了过时的低版本浏览器。\n" +
						  "对您造成的不便, 请谅解!");
Ext.onReady(function() {

	Ext.tip.QuickTipManager.init();
	
	Ext.create('Ext.window.Window', {
	    title: 'DealMe 后台登录',
	    height: 270,
	    width: 400,
	    layout: 'fit',
	    closable: false,
	    renderTo: Ext.getBody(),
	    items: { 
	        xtype: 'form',
	        defaultType: 'textfield',
	        layout: 'anchor',
	        bodyPadding: "20 50 20 50",
	        url: 'user/login',
	        method: "post",
	        defaults: {
	            anchor: '100%'
	        },
	        items: [{
	        	id: "account",
	            fieldLabel: '帐号',
	            labelWidth: 60,
	            name: 'account',
	            height: 26,
	            allowBlank: false,
	            msgTarget: 'side'
	        },{
	        	id: "password",
	            fieldLabel: '密码',
	            name: 'password',
	            labelWidth: 60,
	            height: 26,
	            allowBlank: false,
	            msgTarget: 'side'
	        },{
	        	id: "checkCode",
		        xtype: "panel",
		        layout: "hbox",
		        border: false,
		        items: [{
			        xtype: "textfield",
		        	fieldLabel: '验证码',
		            name: 'checkCode',
		            height: 26,
		            labelWidth: 60,
		            msgTarget: 'side',
		            allowBlank: false,
		            width: 150,
			    }, {
			    	xtype: 'box',
					border: 1,
				    style: {borderColor:'#e6e6e6', borderStyle:'solid', borderWidth:'1px'},
					width: 63,
					height: 26,
					id: "checkImg",
					autoEl: {
						tag: 'img',
						width: 63,
						height: 26,
						src: "checkcode-image",
						complete:'off'
		            }
				}, {
			    	xtype: 'label',
					height: 26,
					html: "<a href='#' onclick='document.getElementById(\"checkImg\").src=\"checkcode-image?id=\" + new Date()'>点击换图</a>"
				}]	
	        }],
	        buttons: [{
	        	text: '登录',
	            formBind: true, 
	            disabled: true,
	            handler: function() {
	                var form = this.up('form').getForm();
	                if (form.isValid()) {
	                    form.submit({
	                        success: function(form, action) {
	                        	if(action.result.success == "true") {
	                    			window.location.href = "admin/index.html";
	                    		} else {
	                    			this.failure(form, action);
	                    		}
	                        },
	                        failure: function(form, action) {
	                        	if(action.result.success == "true") {
	                        		window.location.href = "admin/index.html";
	                        	}
	                        	if(action.result.serverErrMsg) {
	                        		Ext.Msg.alert("Server Error!", action.result.serverErrMsg);
	                        		return;
	                        	}
	                        	if(action.result.accountErrMsg) {
	                        		form.findField("account").markInvalid(action.result.accountErrMsg);
	                        	}
	                        	if(action.result.passwordErrMsg) {
	                        		form.findField("password").markInvalid(action.result.passwordErrMsg);
	                        	}
	                        	if(action.result.checkCodeErrMsg) {
	                        		form.findField("checkCode").markInvalid(action.result.checkCodeErrMsg);
	                        	}
	                        }
	                    });
	                }
	            }
		    }]
	    }
	}).show();
	
	
});